<?php
/**
 * Created by PhpStorm.
 * User: wg
 * Date: 16/4/26
 * Time: 9:50
 */

namespace C\mod{

    use C\lib\Db;
    use C\lib\Sql;

    class siginIn extends mod{

        protected static $__table_s = 'siginin';
        protected static $__primary_s = 'id';

        /*
         * 通过经纬度判断是否在范围内
         * @$lat 经度
         * @lng 纬度
         * */
        static public function scope($lat, $lng) {
            Db::connect();
            $sql = new Sql();
            $sql->select('substring(ploygongeo,10,length(ploygongeo)-11)', static::$__table_s)->append(" WHERE MBRContains(PolygonFromText(ploygongeo),PolygonFromText('Point($lat $lng)'))>0");
            Db::query($sql->sql);
           if ($ps = Db::query($sql->sql)) {
               $list = [];
               while ($o = $ps->fetchObject(static::class))
                   $list[] = $o;
               return $list;
            } else
                return false;
        }

    }

}